package com.hangzhou.xyj.ui.activity;

import android.content.Intent;
import android.view.View;

import com.hangzhou.xyj.R;
import com.hangzhou.xyj.model.UserModel;
import com.hangzhou.xyj.model.type.EIntentTagType;
import com.hangzhou.xyj.ui.activity.base.BaseActivity;
import com.hangzhou.xyj.ui.widget.CircleImageView;
import com.hangzhou.xyj.ui.widget.ClickItemView;
import com.hangzhou.xyj.utils.PublicUtil;
import com.hangzhou.xyj.utils.constants.DataKey;

/**
 * Created by yaohuix on 2016/3/10  15:05
 * <p/>
 * 说明：个人信息
 */
public class PersonalInfoActivity extends BaseActivity {
    private Intent intent;
    private CircleImageView mCivHeadImg;
    private ClickItemView mCivName;
    private ClickItemView mCivGender;
    private ClickItemView mCivHobby;
    private ClickItemView mCivTeacher;
    private ClickItemView mCivDistrict;
    private ClickItemView mCivSign;
    private ClickItemView mCivAuthen;
    private UserModel userInfo;

    private int mIntentTag;

    @Override
    public void initIntentData(Intent intent) {
        mIntentTag = intent.getIntExtra(DataKey.INTENT_TAG, -1);
    }

    @Override
    public void initViews() {
        mCivHeadImg = findView(R.id.civ_header);
        mCivName = findView(R.id.civ_my_name);
        mCivGender = findView(R.id.civ_my_gender);
        mCivHobby = findView(R.id.civ_my_hobby);
        mCivTeacher = findView(R.id.civ_my_teacher);
        mCivDistrict = findView(R.id.civ_my_district);
        mCivSign = findView(R.id.civ_my_signature);
        mCivAuthen = findView(R.id.civ_my_authen);
    }

    @Override
    public void initDatas() {
        intent = getIntent();
        userInfo = (UserModel) intent.getSerializableExtra("userInfo");
        mCivHeadImg.displayImage(userInfo.getHeadPic());//设置头像
        mCivName.setRightText(userInfo.getNickName());//设置昵称
        mCivGender.setRightText(userInfo.getSex());//设置性别
        mCivHobby.setRightText(userInfo.getHobby());//设置爱好
        mCivTeacher.setRightText(userInfo.getTeacher());//设置师从
        mCivDistrict.setRightText(userInfo.getZone());//设置区域
        mCivSign.setRightText(userInfo.getSignature());//设置签名
        if (mIntentTag == EIntentTagType.TAG_MINE.getValue()) {
            mCivAuthen.setVisibility(View.VISIBLE);
            mCivAuthen.setRightIcon(PublicUtil.getAuthenIconStringUri(mContext, userInfo.getUserType()));//设置认证图标
        } else {
            mCivAuthen.setVisibility(View.GONE);
        }
    }

    @Override
    public void initLayouts() {
        setContentView(R.layout.activity_personal_info);
    }

    @Override
    public void initListeners() {

    }

    @Override
    public void initTop() {
        enableTitle(true, "个人信息");
        enableRefresh(false);
    }


    /**
     * 设置数据
     *
     * @param
     * @return
     * @author yaohuix
     * @date 2016/3/10 15:16
     */
    public void setData(UserModel data) {

    }
}
